import {
  List,
  Modal,
  Grid,
  DatePickerView,
  Toast,
  Tabs,
  WhiteSpace,
  Badge,
} from 'antd-mobile';
import { Button, Divider, Alert } from 'antd';
import moment from 'moment';
import React, { useState } from 'react';
import { connect, history } from 'umi';
import { PlusCircleFilled } from '@ant-design/icons';
import BackIcon from '@/components/BackIcon';
import { useEffect } from 'react';
import { getFetch } from '@/utils/doFetch';
import { useMemo } from 'react';
import PublicList from '@/components/PublicList';
import { company_bc, company_tax } from '@/services/factory';
import styles from './index.less';

const tabs = [
  { title: <Badge>税务申报</Badge> },
  { title: <Badge>工商年报</Badge> },
];

let Header = connect(({ global, loading }) => ({
  global,
  loading,
}))(({ global: { userinfo, companies } }) => {
  return <div></div>;
});

let Resource = ({ global: { userinfo, companies } }) => {
  return (
    <div style={{ height: '100%', overflow: 'hidden' }}>
      <div
        style={{
          padding: '18px 0 0 0',
          backgroundColor: '#fff',
          textAlign: 'center',
          fontSize: 20,
          fontWeight: 'bolder',
        }}
      >
        {companies?.name}
      </div>
      <Tabs
        tabs={tabs}
        initialPage={0}
        onChange={(tab, index) => {
          console.log('onChange', index, tab);
        }}
        onTabClick={(tab, index) => {
          console.log('onTabClick', index, tab);
        }}
      >
        <div style={{ height: '100%', backgroundColor: '#fff' }}>
          <PublicList
            Header={Header}
            post={company_tax}
            params={{ company_id: companies?.id }}
            type="tax"
          ></PublicList>
        </div>
        <div style={{ height: '100%', backgroundColor: '#fff' }}>
          <PublicList
            Header={Header}
            post={company_bc}
            params={{ company_id: companies?.id }}
            type="bc"
          ></PublicList>
        </div>
      </Tabs>

      <BackIcon></BackIcon>
    </div>
  );
};

export default connect(({ global, loading }) => ({
  global,
  loading,
}))(Resource);
